package com.tuniu.agents.common;

import java.util.Locale;

public interface I18nService {

    /**
     * Retrieves a message for a specific conversation.
     * 
     * @param conversationId The ID of the conversation.
     * @param code The message code.
     * @param args Arguments for the message.
     * @param defaultMessage The default message if the code is not found.
     * @return The message for the conversation.
     */
    String getMessageForConversation(String conversationId, String code, Object[] args, String defaultMessage);

    /**
     * Gets the locale for a specific conversation.
     * 
     * @param conversationId The ID of the conversation.
     * @return The locale for the conversation.
     */
    Locale getLocaleForConversation(String conversationId);

    /**
     * Sets the locale for a specific conversation.
     * 
     * @param conversationId The ID of the conversation.
     * @param locale The locale to set.
     */
    void setLocaleForConversation(String conversationId, Locale locale);

    /**
     *
     * @param code
     * @param args
     * @param defaultMessage
     * @return
     */
    String getMessage(String code, Object[] args, String defaultMessage);

    /**
     * Retrieves a message based on the locale context.
     * 
     * @param localeContextId The locale context ID.
     * @param code The message code.
     * @param args Arguments for the message.
     * @param defaultMessage The default message if the code is not found.
     * @return The message based on the locale context.
     */
    String getMessage(String localeContextId, String code, Object[] args, String defaultMessage);

    /**
     * Retrieves a message based on the provided locale.
     *
     * @param code The code that identifies the message to be retrieved.
     * @param args Arguments to be used in the message (if the message contains placeholders).
     * @param defaultMessage The default message to return if the specified code is not found.
     * @param locale The locale for which the message should be retrieved.
     * @return The message for the specified locale, or the default message if the code is not found.
     */
    String getMessage(String code, Object[] args, String defaultMessage, Locale locale);

    /**
     * Gets the default locale.
     * 
     * @return The default locale.
     */
    Locale getLocale();

    /**
     * Gets the locale based on the provided context ID.
     * 
     * @param localeContextId The locale context ID.
     * @return The locale for the given context ID.
     */
    Locale getLocale(String localeContextId);

    /**
     * Sets the locale based on the provided context ID.
     * 
     * @param localeContextId The locale context ID.
     * @param locale The locale to set.
     */
    void setLocale(String localeContextId, Locale locale);
}
